Skip to content

Deserialization support for AWS LSP extended InitializeResult - #49

Merged
breedloj merged 2 commits into
mainfrom
breedloj/deserInitializeResult
Oct 2, 2024
Merged

Deserialization support for AWS LSP extended InitializeResult#49
breedloj merged 2 commits into
mainfrom
breedloj/deserInitializeResult

Conversation

@breedloj

@breedloj breedloj commented Oct 2, 2024

Copy link
Copy Markdown
Contributor

Description of changes:
AWS Flare LSPs extend the basic LSP InitializeResult with extended metadata, such as available chat commands. By default these additional properties are lost by LSP4j's deserialization logic. This change models the extended type and registers in a custom type adapter for GSON (LSP4j's deser library) to deserialize into the extended type and therefore surface the properties.

Keep in mind that there may be additional properties that need to be modeled to the extended InitializeResult, but I am illustrating the pattern for accessing the chat commands here.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.


@Override
@SuppressWarnings("unchecked")
public final <T> TypeAdapter<T> create(final Gson gson, final TypeToken<T> type) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had everything in this PR ready in a branch except for this class. Thanks for looking into it!

@breedloj
breedloj merged commit f648b5c into main Oct 2, 2024
@breedloj
breedloj deleted the breedloj/deserInitializeResult branch October 2, 2024 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants